﻿//-----------------------------------------------------------------------
// <copyright>
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//----------------------------------------------------------------------- 
using System.Xml;

namespace Fulcrum.ControlGenerator
{
    class RoutedCommandBindingXmlConfiguration : IRoutedCommandBindingConfiguration
    {
        public RoutedCommandBindingXmlConfiguration(XmlReader xmlReader)
        {
            // TODO Name can't be null or empty
            // TODO owning type can't be null or empty
            // TODO summary can be null or empty, but standardize
            this.Name = xmlReader.GetAttribute("name");
            this.OwningType = xmlReader.GetAttribute("owningType");
            this.Summary = xmlReader.GetAttribute("summary");
            this.CanExecuteAlways = XmlReaderHelp.GetOptionalBoolAttributeValue(xmlReader, "canExecuteAlways", true);

            xmlReader.Read();
        }

        public string Name
        {
            get;
            private set;
        }

        public string OwningType
        {
            get;
            private set;
        }

        public string Summary
        {
            get;
            private set;
        }

        public bool CanExecuteAlways
        {
            get;
            private set;
        }

    }
}
